home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / UTILITY1 / MSWLGO35.ZIP / EXAMPLES / VISUAL.WIN < prev   
Text File  |  1993-08-23  |  26KB  |  907 lines

  1. ;
  2. ; Function:
  3. ;
  4. ; This function is a simple DialogBox editor. It is still incomplete
  5. ; but is usable. In fact I wrote part of this application with itself !!!
  6. ;
  7. ; To run:
  8. ;
  9. ; Load "visual.win
  10. ; Call visual
  11. ; <click on load button>
  12. ; <enter "boxes">
  13. ;
  14. ; To move a control, click down with mouse in the upper left corner inside
  15. ; the box and drag it. Then let mouse button go.
  16. ;
  17. ; To resize a control, click down with mouse in the lower right corner inside
  18. ; the box and drag it. Then let mouse button go.
  19. ;
  20. ; To change parameters on a box or delete it click in the middle of the control
  21. ;
  22. ; To see what the dialog really looks like click on the Test Button.
  23. ; Click EndTest button to close it.
  24. ;
  25. ; To snap each control to a grid in the snap to grid button and enter
  26. ; grid size.
  27. ;
  28. ; To save the changes click on save (note testing does a save).
  29. ;
  30. ; If dragging is to slow hot fast drag
  31. ;
  32. ; To add a control hit one of the "NEW-" bottons. The control will be
  33. ; placed in the upper left corner outside of the dialog box.
  34. ;
  35. ; To select the DIalog box itself for resizing, click
  36. ; anywhere inside the dialog box but not on a control.
  37. ;
  38. ; It does not know about the code that actaully makes the dialog
  39. ; box/window itself, just the control in one.
  40. ;
  41. ; It does not know about ANY other code except "SOMETHINGcreate".
  42. ;
  43. ; If you put all your code that "CREATE"s controls in one procedure,
  44. ; it's almost usable. I used it for all the dialogs in this application
  45. ; and found an improment over calculating coordinates.
  46. ;
  47. ; If also expects ALL text arguments to be LISTs (even though
  48. ; words are legal).
  49. ;
  50. ; Some day I hope to finish this and perhaps add hooks (or rewrite in C)
  51. ; to MswLogo so that REAL buttons can be dragged FAST. 
  52. ;
  53. to boxes
  54. groupboxcreate "main [group1] 20 50 70 50
  55. radiobuttoncreate "main [group1] [Radio1] [Radio Button] 30 60 50 10
  56. checkboxcreate "main [group1] [check1] [Check Box] 30 80 50 10
  57. scrollbarcreate "main [Scroll1] 20 30 70 10 [Print "Scrolled]
  58. buttoncreate "main [Button1] [Button to be Push] 20 10 50 10 [Print "Push]
  59. comboboxcreate "main [combo1] 20 110 50 30
  60. listboxcreate "main [list1] 20 150 70 20
  61. staticcreate "main [static1] [This is a static box] 20 180 140 10
  62. end
  63.  
  64. to deletething
  65. unselectbox :select
  66. setpensize [2 2]
  67. drawbox_detail last :select first :select
  68. make "select []
  69. end
  70.  
  71. to doclose2
  72. ifelse equalp first :select "buttoncreate~
  73.   [~
  74.   make "the_last last :select~
  75.   make "the_title comboboxgettext "cb22~
  76.   make "the_cb comboboxgettext "cb21~
  77.   make "the_name comboboxgettext "cb23~
  78.   make "select butlast butlast butlast butlast :select~
  79.   make "select lput :the_name :select~
  80.   make "select lput :the_title :select~
  81.   make "select lput :the_cb :select~
  82.   make "select lput :the_last :select~
  83.   ]~
  84.   [~
  85.   ifelse equalp first :select "scrollbarcreate~
  86.     [~
  87.     make "the_cb comboboxgettext "cb21~
  88.     make "the_last last :select~
  89.     make "the_name comboboxgettext "cb23~
  90.     make "select butlast butlast butlast :select~
  91.     make "select lput :the_name :select~
  92.     make "select lput :the_cb :select~
  93.     make "select lput :the_last :select~
  94.     ]~
  95.     [~
  96.     ifelse equalp :kind "staticcreate~
  97.       [~
  98.       make "the_title comboboxgettext "cb22~
  99.       make "the_last last :select~
  100.       make "the_name comboboxgettext "cb23~
  101.       make "select butlast butlast butlast :select~
  102.       make "select lput :the_name :select~
  103.       make "select lput :the_title :select~
  104.       make "select lput :the_last :select~
  105.       ]~
  106.       [~
  107.       ifelse (or equalp :kind "radiobuttoncreate~
  108.                      equalp :kind "checkboxcreate)~
  109.         [~
  110.         make "the_title comboboxgettext "cb22~
  111.         make "the_last last :select~
  112.         make "the_name comboboxgettext "cb23~
  113.         make "the_group comboboxgettext "cb24~
  114.         make "select butlast butlast butlast butlast :select~
  115.         make "select lput :the_group :select~
  116.         make "select lput :the_name :select~
  117.         make "select lput :the_title :select~
  118.         make "select lput :the_last :select~
  119.         ]~
  120.         [~
  121.         make "the_last last :select~
  122.         make "the_name comboboxgettext "cb23~
  123.         make "select butlast butlast :select~
  124.         make "select lput :the_name :select~
  125.         make "select lput :the_last :select~
  126.         ]~
  127.       ]~
  128.     ]~
  129.   ]
  130. dialogdelete "dlg2
  131. end
  132.  
  133. to doclose3
  134. make "main_x first comboboxgettext "cb31
  135. make "main_y first comboboxgettext "cb32
  136. dialogdelete "dlg3
  137. vrefresh
  138. end
  139.  
  140. to doinit2
  141. make "kind first :select
  142. ifelse equalp :kind "buttoncreate~
  143.   [~
  144.   make "the_cb last butlast :select~
  145.   make "the_title last butlast butlast :select~
  146.   make "the_name last butlast butlast butlast :select~
  147.   make "the_group "N/A~
  148.   comboboxsettext "cb24 :the_group~
  149.   comboboxsettext "cb23 :the_name~
  150.   comboboxsettext "cb22 :the_title~
  151.   comboboxsettext "cb21 :the_cb~
  152.   ]~
  153.   [~
  154.   ifelse equalp :kind "scrollbarcreate~
  155.     [~
  156.     make "the_cb last butlast :select~
  157.     make "the_name last butlast butlast :select~
  158.     make "the_title "N/A~
  159.     make "the_group "N/A~
  160.     comboboxsettext "cb24 :the_group~
  161.     comboboxsettext "cb23 :the_name~
  162.     comboboxsettext "cb22 :the_title~
  163.     comboboxsettext "cb21 :the_cb~
  164.     ]~
  165.     [~
  166.     ifelse equalp :kind "staticcreate~
  167.       [~
  168.       make "the_cb "N/A~
  169.       make "the_title last butlast :select~
  170.       make "the_name last butlast butlast :select~
  171.       make "the_group "N/A~
  172.       comboboxsettext "cb24 :the_group~
  173.       comboboxsettext "cb23 :the_name~
  174.       comboboxsettext "cb22 :the_title~
  175.       comboboxsettext "cb21 :the_cb~
  176.       ]~
  177.       [~
  178.       ifelse (or equalp :kind "radiobuttoncreate~
  179.                      equalp :kind "checkboxcreate)~
  180.         [~
  181.         make "the_cb "N/A~
  182.         make "the_title last butlast :select~
  183.         make "the_name last butlast butlast :select~
  184.         make "the_group last butlast butlast butlast :select~
  185.         comboboxsettext "cb24 :the_group~
  186.         comboboxsettext "cb23 :the_name~
  187.         comboboxsettext "cb22 :the_title~
  188.         comboboxsettext "cb21 :the_cb~
  189.         ]~
  190.         [~
  191.         make "the_cb "N/A~
  192.         make "the_title "N/A~
  193.         make "the_name last butlast :select~
  194.         make "the_group "N/A~
  195.         comboboxsettext "cb24 :the_group~
  196.         comboboxsettext "cb23 :the_name~
  197.         comboboxsettext "cb22 :the_title~
  198.         comboboxsettext "cb21 :the_cb~
  199.         ]~
  200.       ]~
  201.     ]~
  202.   ]
  203. end
  204.  
  205. to doinit3
  206. comboboxsettext "cb31 :main_x
  207. comboboxsettext "cb32 :main_y
  208. end
  209.  
  210. to dosetup
  211. buttoncreate "dlg "New5 "New-ComboBox 15 85 55 15 [newbutton "comboboxcreate]
  212. buttoncreate "dlg "Save "Save 85 95 50 15 [vsave]
  213. buttoncreate "dlg "New2 "New-ScrollBar 15 25 55 15 [newbutton "scrollbarcreate]
  214. buttoncreate "dlg "Load "Load 140 95 45 15 [vload first readlist]
  215. buttoncreate "dlg "Fast "Fast-Drag 140 115 45 15 [Make "slowmode "false]
  216. buttoncreate "dlg "Snap "Snap 105 15 65 15 [snapboxes]
  217. buttoncreate "dlg "New1 "New-Button 15 5 55 15 [newbutton "buttoncreate]
  218. buttoncreate "dlg "Slow "Slow-Drag 85 115 50 15 [Make "slowmode "true]
  219. buttoncreate "dlg "New9 "New-CheckBox 15 145 55 15 [newbutton "checkboxcreate]
  220. buttoncreate "dlg "Test "Test 85 75 50 15 [mytest]
  221. buttoncreate "dlg "end "End 80 165 50 15 [visualend]
  222. buttoncreate "dlg "Refresh "Refresh 105 35 65 15 [vrefresh]
  223. buttoncreate "dlg "End [End Test] 140 75 45 15 [myendtest]
  224. buttoncreate "dlg "New4 "New-RadioBtn 15 125 55 15 [newbutton "radiobuttoncreate]
  225. buttoncreate "dlg "New3 "New-GroupBox 15 105 55 15 [newbutton "groupboxcreate]
  226. buttoncreate "dlg "New8 "New-StaticBox 15 45 55 15 [newbutton "staticcreate]
  227. buttoncreate "dlg "New7 "New-ListBox 15 65 55 15 [newbutton "listboxcreate]
  228. end
  229.  
  230. to dosetup2
  231. comboboxcreate "dlg2 "cb21 60 12 60 12
  232. comboboxcreate "dlg2 "cb22 60 36 60 12
  233. staticcreate "dlg2 "st22 [Title] 12 36 36 12
  234. staticcreate "dlg2 "st21 [Callback] 12 12 36 12
  235. staticcreate "dlg2 "st23 [Name] 12 60 36 12
  236. buttoncreate "dlg2 "dlg2_OK [OK] 12 132 48 12 [doclose2]
  237. buttoncreate "dlg2 "btn23 [Cancel] 72 132 48 12 [dialogdelet